package com.vcar.LDiceClient.module.storeModule
{
	/**
	 * 店铺模型  最新修改
	 * @author Rices
	 */
	import com.vcar.LDiceClient.config.GlobalEventName;
	import com.vcar.LDiceClient.config.MediatorName;
	import com.vcar.LDiceClient.config.ModuleName;
	import com.vcar.LDiceClient.config.ProxyNames;
	import com.vcar.LDiceClient.dataproxy.RequestMessage;
	import com.vcar.LDiceClient.dataproxy.ResponseMessage;
	import com.vcar.LDiceClient.dataproxy.SocketProxy;
	import com.vcar.LDiceClient.dataproxy.module.ModuleInfo;
	import com.vcar.LDiceClient.dataproxy.user.UserProxy;
	
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	
	import mx.collections.ArrayCollection;
	import mx.core.UIComponent;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	
	public class storeModuleMediator extends Mediator
	{
		/**
		 * 构造函数
		 * @param viewComponent
		 */
		public function storeModuleMediator(viewComponent:Object=null)
		{
			super(MediatorName.storeModuleMediator, viewComponent);
			
			init();
			view.main.addEventListener(MouseEvent.MOUSE_DOWN,function ():void{
				view.main.startDrag();
			});
			view.main.addEventListener(MouseEvent.MOUSE_UP,function ():void{
				view.main.stopDrag();
			});
		}
		
		/**
		 * 获取Module实例 
		 * @return 
		 */
		public function get view():storeModule
		{
			return viewComponent as storeModule;
		}
		
		/**
		 * 定义兴趣事件列表 
		 * @return 
		 */
		override public function listNotificationInterests():Array
		{
			return [GlobalEventName.STORE_EXIT_SUSS,
				GlobalEventName.STORE_GETDATA_SUSS,
				GlobalEventName.STORE_ITEMPICKUP_SUSS,
				GlobalEventName.STORE_ITEMPICKDOWN_SUSS,
				GlobalEventName.STORE_SITDOWN_SUSS,
				GlobalEventName.STORE_STANDUP_SUSS,
				GlobalEventName.GAME_READY_SUSS
			];
		}
		
		/**
		 * 兴趣事件处理函数
		 * @param notification
		 */
		override public function handleNotification(notification:INotification):void
		{
			var obj:ResponseMessage=notification.getBody() as ResponseMessage;			
			switch (notification.getName())
			{
				
				case GlobalEventName.STORE_EXIT_SUSS:
				{
					var m:ModuleInfo=new ModuleInfo(ModuleName.HALL_MODULE);
					sendNotification(GlobalEventName.MODULE_CHANGE,m);
				}
					break;
				case GlobalEventName.STORE_GETDATA_SUSS://接收场景信息
				{
					var p:UserProxy=facade.retrieveProxy(ProxyNames.UserProxy) as UserProxy;
					UserId=p.currentUserVO.username;					
					sceneData=obj.object.storeData.mapData;
					loadScene();					
					deskData=obj.object.storeData.deskList;
					loadTable();					
					getItemData(obj.object.storeData.itemList);				
					
				}
					break;
				case GlobalEventName.STORE_ITEMPICKUP_SUSS://接收椅子拿起信息
				{
					pickUserId=obj.target;
					getPickItemId(obj.object,pickUserId);					
				}
					break;
				case GlobalEventName.STORE_ITEMPICKDOWN_SUSS://接收椅子放下信息
				{
					downUserId=obj.target;
					getPickItemDown(obj.object,downUserId);
				}
					break;
				case GlobalEventName.STORE_SITDOWN_SUSS://接收坐下信息
				{						
					getSitInfo(obj.target,obj.object.itemId);				
				}
					break;
				case GlobalEventName.STORE_STANDUP_SUSS://接收站起信息
				{
					getStandInfo(obj.target,obj.object.itemId);	
				}
					break;
				case GlobalEventName.GAME_READY_SUSS://用户准备
				{
					
				}
					break;
			}
		}
		
		/**
		 * 下面为功能代码 
		 */		
		
		/**
		 *下面为函数所需变量 
		 */
		private var pickUserId:String;
		private var downUserId:String;
		private var UserId:String;
		private var pickItem:Array=new Array();
		private var sceneData:Array=new Array();
		private var itemArray:Array=new Array();
		private var deskData:ArrayCollection=new ArrayCollection();		
		private var heading:Array=new Array();			
		private var itemList:Object=new Object();
		private var obstacle:Array=new Array();			
		private var dragTarget:MovieClip=null;		
		private var standing:Boolean=true;
		
		/**
		 *下面为店铺功能 代码
		 */	
		
		/**
		 * 发送6，2请求服务器获取店铺场景信息
		 * 
		 */
		private function init():void
		{
			var reMessage:RequestMessage = new RequestMessage();
			var proxy:SocketProxy = facade.retrieveProxy(ProxyNames.SocketProxy) as SocketProxy;
			reMessage.type=6;
			reMessage.subtype=2;
			proxy.send(reMessage);				
		}		
		
		/**
		 *下面是当收到6.2返回信息所激活的函数
		 * @param e 
		 * 
		 */			
		private function getItemData(_itemData:Object):void
		{
			itemList=_itemData;
			for (var i:String in itemList)
			{
				itemArray.push(
					itemList[i]		
				)					
			}
			loadItem();				
		}
		
		
		//加载场景>>>>
		private function loadScene():void
		{
			var sceneItself:MovieClip=new MovieClip();
			var sceneType:String;			
			for (var x:int=0;x<sceneData.length;x++)
			{	
				obstacle[x]=new Array();
				heading[x]=new Array();
				for(var y:int=0;y<sceneData[x].length;y++)
				{
					heading[x][y]=5;
					if(y==0 ||x==0)
					{
						sceneType="Wall";
					}
					else {
						sceneType="ground";
					}
					switch (sceneType)
					{
						case "Wall":
						{
							sceneItself=new wall();
							obstacle[x][y]="Wall";							
						}
							break;
						case "ground":
						{
							sceneItself=new ground();
							obstacle[x][y]=false;
						}
							break;
					}												
					view.baseLayer.addChild(sceneItself);
					sceneItself.scaleX=(x==0)?1:-1;
					sceneItself.gotoAndStop(sceneData[x][y]);
					sceneItself.x=oneToTwo(new Point(x,y)).x;
					sceneItself.y=oneToTwo(new Point(x,y)).y;					
				}
			}
		}		
		//<<<<加载场景	
		
		//加载引导层>>>>
		private function loadGuide():void
		{			
			for (var x:int=1;x<sceneData.length;x++)
			{
				
				for(var y:int=1;y<sceneData[x].length;y++)
				{
					var guideItself:baseGrid=new baseGrid();
					view.guideLayer.addChild(guideItself);
					guideItself.gotoAndStop(1);
					guideItself.x=oneToTwo(new Point(x,y)).x;
					guideItself.y=oneToTwo(new Point(x,y)).y;
					guideItself.addEventListener(MouseEvent.MOUSE_OVER,mouseOverChange);
					guideItself.addEventListener(MouseEvent.MOUSE_OUT,mouseOutInit);
				}
			}
		}
		//<<<<加载引导层
		
		//加载物品层>>>>		
		private function loadItem() :void
		{		
			var item:MovieClip=new MovieClip();			
			for (var i:int=0;i<itemArray.length;i++)
			{			
				var itemX:int=itemArray[i]["itemX"];
				var itemY:int=itemArray[i]["itemY"];
				var itemType:int=int(itemArray[i]["itemType"]);
				var itemI:int=int(itemType/1000);
				switch(itemI)
				{
					case 1:{						
						item=new chair();
						obstacle[itemX][itemY]="chair";					
					}
						break;
					case 5:{
						item=new door();
						obstacle[itemX][itemY]="wall";
					}
						break;						
				}
				var itemId:int=itemArray[i]["itemId"];
				item.id=itemId;
				item.name=itemArray[i]["itemId"];
				var itemDrag:Boolean=itemArray[i]["dragAble"];
				var itemHeading:int=itemArray[i]["itemHeading"];
				var itemDraging:String=itemArray[i]["draging"];
				var itemuserId:String=itemArray[i]["userId"];
				var itemS:int=itemType%1000*2-1;
				item.scaleX=(itemHeading==1||itemHeading==2)?-1:1;				
				item.gotoAndStop(itemS+int(itemHeading/2));						
				item.x=oneToTwo(new Point(itemX,itemY)).x;
				item.y=oneToTwo(new Point(itemX,itemY)).y;	
				if (itemDrag==true)
				{
					item.addEventListener(MouseEvent.CLICK,sendItemId);		
				}							
				if (itemDraging==null)
				{
					item.alpha=1;					
				}
				else 
				{
					item.alpha=0.5;
				}
				if (itemI==5)
				{
					item.addEventListener(MouseEvent.CLICK,outStore);
					item.alpha=1;
				}							
				//下面是坐下按钮的加入，条件:heading[x][y]为0-3，并且 不被拿起
				if(obstacle[itemX][itemY]=="chair" && heading[itemX][itemY]!=5 && item.alpha==1)
				{			
					var chairBtn:chairState=new chairState();
					addBtn(chairBtn,item.x,item.y,item.name);
					if (itemuserId!=null)
					{
						chairBtn.username=itemuserId;
						item.removeEventListener(MouseEvent.CLICK,sendItemId);	
					}
					view.btnLayer.addChild(chairBtn);
					handingChange(item,heading[itemX][itemY]);
				}
				view.itemLayer.addChild(item);
			}
			sortInit(view.itemLayer);
		}		
		//<<<<加载物品层		
		//加载桌子>>>>
		private function loadTable():void
		{			
			for (var i:int=0;i<deskData.length;i++)
			{
				var desk:table=new table();
				var deskAdmin:String=deskData[i].admin;				
				var point:Point=oneToTwo(new Point(deskData[i].deskX,deskData[i].deskY));				
				var _x:int=deskData[i].deskX;
				var _y:int=deskData[i].deskY;
				view.itemLayer.addChild(desk);
				desk.x=point.x;
				desk.y=point.y;			
				desk.name="desk"+i;				
				obstacle[deskData[i].deskX][deskData[i].deskY]="table";
				if (obstacle[deskData[i].deskX][deskData[i].deskY+1]!="table")
				{
					heading[deskData[i].deskX][deskData[i].deskY+1]=2;
				}
				if (obstacle[deskData[i].deskX+1][deskData[i].deskY]!="table")
				{
					heading[deskData[i].deskX+1][deskData[i].deskY]=3;
				}
				if (obstacle[deskData[i].deskX][deskData[i].deskY-1]!="table")
				{
					heading[deskData[i].deskX][deskData[i].deskY-1]=0;
				}
				if (obstacle[deskData[i].deskX-1][deskData[i].deskY]!="table")
				{
					heading[deskData[i].deskX-1][deskData[i].deskY]=1;
				}				
			}			
		}		
		//<<<<加载桌子
		
		/**
		 *发送7.5请求，发送需要拿起椅子的ID 
		 * @param e  需要被拿起的item
		 * 
		 */		
		private function sendItemId(e:Event=null):void
		{	
			var reMessage:RequestMessage = new RequestMessage();
			var proxy:SocketProxy = facade.retrieveProxy(ProxyNames.SocketProxy) as SocketProxy;
			reMessage.type=7;
			reMessage.subtype=5;
			reMessage.params.itemId=e.target.id;
			proxy.send(reMessage);				
		}
		
		/**
		 *接收到7.5的返回信息并对其运算 	，判断是否自己拿起，并相应发送给函数处理	 
		 * @param _obj     返回的对象
		 * @param _userId  拿起椅子人的uid信息  
		 * 
		 */		
		private function getPickItemId(_obj:Object,_userId:String=null):void
		{
			var itemId:String=_obj.itemId;
			if (itemId==null)
			{				
			}
			else 
			{
				var point:Point=twoToOne(new Point(view.itemLayer.getChildByName(itemId).x,view.itemLayer.getChildByName(itemId).y));
				if (heading[point.x][point.y]!=5)
				{
					var btnName:String=itemId+"chairBtn";
					view.btnLayer.removeChild(view.btnLayer.getChildByName(btnName));
				}
				if(_userId==UserId)
				{
					itemUp(itemId);					
				}
				else 
				{
					view.itemLayer.getChildByName(itemId).alpha=0.5;					
					obstacle[point.x][point.y]=false;
				}
			}
		}
		
		/**
		 * 椅子拿起函数，并展开引导层。
		 * 由getPickItemId在_userId==UserId（自己拿起）情况下触发
		 * @param itemId  需要拿起的椅子的ID
		 * 
		 */		
		private function itemUp(itemId:String=null):void
		{
			if (itemId==null)
			{				
			}
			else 
			{					
				view.itemLayer.mouseEnabled=false;
				view.itemLayer.mouseChildren=false;
				var item:MovieClip=view.itemLayer.getChildByName(itemId) as MovieClip;				
				item.alpha=0.5;				
				var x:int=twoToOne(new Point(item.x,item.y)).x;
				var y:int=twoToOne(new Point(item.x,item.y)).y;				
				obstacle[x][y]=false;
				dragTarget=item;
				loadGuide();				
			}
		}
		/**
		 *拖动时触发的函数，并设置椅子转向，样式和位置 ，触发为地板的mouseEvent，并为其加入sendItemStop函数的点击监听
		 * @param e  触发函数的对象
		 * 
		 */		
		private function mouseOverChange(e:Event):void
		{
			var ground:MovieClip=e.target as MovieClip;
			var x:int=twoToOne(new Point(ground.x,ground.y)).x;
			var y:int=twoToOne(new Point(ground.x,ground.y)).y;			
			var changeType:String=obstacle[x][y];
			var heading:int=heading[x][y];
			if (chairHeading==5)
			{
				for(var i:int=0;i<heading[x].length;i++)
				{
					if(itemArray[i]["itemId"]==dragTarget.name)
					{
						break;
					};
				}
				chairHeading=itemArray[i]["itemHeading"];
			}
			var chairHeading:int;
			switch(changeType)
			{
				case "table":{
					ground.gotoAndStop(4);
				}
					break;
				case "chair":{
					ground.gotoAndStop(4);
				}
					break;
				case "false":{				 
					switch(heading)
					{
						case 0:{						  
							chairHeading=0;						
						}
							break;
						case 1:{						  
							chairHeading=1;
						}
							break;
						case 2:{						  
							chairHeading=2;
						}
							break;
						case 3:{						  
							chairHeading=3;
						}
							break;
						case 5:{
						}
							break;					  
					}
					var chair:MovieClip=view.itemLayer.getChildByName(dragTarget.name) as MovieClip;					
					handingChange(chair,chairHeading);
					chair.x=ground.x;
					chair.y=ground.y;
					ground.gotoAndStop(3);
					ground.addEventListener(MouseEvent.CLICK,sendItemStop)
				}
					break;		  
			}
		}
		/**
		 *地板样式恢复 ，并移除函数sendItemStop的点击监听
		 * @param e  对象地板
		 * 
		 */		
		private function mouseOutInit(e:Event):void
		{
			(e.target as MovieClip).gotoAndStop(1);
			(e.target as MovieClip).removeEventListener(MouseEvent.CLICK,sendItemStop);
		}
		/**
		 *处理椅子放下的数据，向服务器发送7.6请求，
		 * 并发送 椅子的方向(chairHeading)，位置(X,Y),ID	 * 
		 * @param e
		 * 
		 */		
		private function sendItemStop(e:Event):void
		{			
			var ground:MovieClip=e.target as MovieClip;
			var x:int=twoToOne(new Point(ground.x,ground.y)).x;
			var y:int=twoToOne(new Point(ground.x,ground.y)).y;
			var chair:MovieClip=view.itemLayer.getChildByName(dragTarget.name) as MovieClip;
			var chairHeading:int=heading[x][y];
			if (chairHeading==5)
			{
				for(var i:int=0;i<heading[x].length;i++)
				{
					if(itemArray[i]["itemId"]==dragTarget.name)
					{
						break;
					};
				}
				chairHeading=itemArray[i]["itemHeading"];
			}
			if (obstacle[x][y]==false)
			{				
				var reMessage:RequestMessage = new RequestMessage();
				var proxy:SocketProxy = facade.retrieveProxy(ProxyNames.SocketProxy) as SocketProxy;
				reMessage.type=7;
				reMessage.subtype=6;
				reMessage.params.itemId=chair.id;
				reMessage.params.x=x;
				reMessage.params.y=y;
				reMessage.params.heading=chairHeading;
				proxy.send(reMessage);	
			}
		}
		/**
		 *接受7.6所返回的信息并处理椅子放下的信息 ，
		 * 并为桌子旁的椅子添加坐下按钮
		 * @param _obj  返回信息中要放下的对象
		 * @param _userId   放下的人的uid
		 * 
		 */		
		private function getPickItemDown(_obj:Object,_userId:String):void
		{
			var itemId:String=_obj.itemId;
			var chair:MovieClip=view.itemLayer.getChildByName(itemId) as MovieClip;
			var chairHeading:int=_obj.heading;
			handingChange(chair,chairHeading);			
			chair.alpha=1;
			chair.x=oneToTwo(new Point(_obj.x,_obj.y)).x;
			chair.y=oneToTwo(new Point(_obj.x,_obj.y)).y;
			obstacle[_obj.x][_obj.y]="chair";
			if(_userId==UserId)
			{
				view.itemLayer.mouseEnabled=true;
				view.itemLayer.mouseChildren=true;	
				var iout:int=view.guideLayer.numChildren;
				for (var i:int=0;i<iout;i++)
				{
					view.guideLayer.removeChildAt(0);					
				}								
			}
			var heading:int=heading[_obj.x][_obj.y];
			if (heading!=5)
			{
				var chairBtn:chairState=new chairState();
				addBtn(chairBtn,chair.x,chair.y,chair.name);					
				view.btnLayer.addChild(chairBtn);
			}
			sortInit(view.itemLayer);
		}		
		/**
		 *设置坐下按钮属性函数 
		 * @param chairBtn  按钮本身
		 * @param x         按钮位置x坐标
		 * @param y			按钮位置x坐标
		 * @param thisName  按钮相对应的椅子id
		 * 
		 */	
		private function addBtn(chairBtn:chairState,x:int,y:int,thisName:String):void
		{
			
			chairBtn.x=x;
			chairBtn.y=y-20;			
			chairBtn.username="";
			chairBtn.visible=true;	
			chairBtn.name=thisName+"chairBtn";			
			chairBtn.id=thisName;
			chairBtn.addEventListener(MouseEvent.CLICK,sitChair);
		}
		/**
		 *发送坐下信息7.2和对应的椅子Id，并请求返回信息 
		 * @param e
		 * 
		 */		
		private function sitChair(e:MouseEvent):void
		{	
			e.stopPropagation();			
			var chairName:int=int(e.currentTarget.name.slice(0,3));		
			var reMessage:RequestMessage = new RequestMessage();
			var proxy:SocketProxy = facade.retrieveProxy(ProxyNames.SocketProxy) as SocketProxy;
			reMessage.type=7;
			reMessage.subtype=2;			
			reMessage.params.itemId=chairName;			
			proxy.send(reMessage);	
		}
		/**
		 *接收7.2的返回信息，并处理坐下信息 
		 * @param userName   返回信息中坐下的人的uid
		 * @param itemId	   返回信息中坐下的椅子id
		 * 
		 */		
		private function getSitInfo(userName:String,itemId:int):void
		{				
			var chairName:String=itemId.toString();
			var chairBtn:chairState=view.btnLayer.getChildByName(chairName+"chairBtn") as chairState;
			var chair:MovieClip=view.itemLayer.getChildByName(chairName) as MovieClip;
			if(userName==UserId)
			{					
				
				var iout:int=view.btnLayer.numChildren;
				for (var i:int=0;i<iout;i++)
				{
					if ((view.btnLayer.getChildAt(i) as chairState).nameMc.visible==true)
					{
						view.btnLayer.getChildAt(i).visible=true;	
					}
					else{view.btnLayer.getChildAt(i).visible=false;}
				}
				standing=false;
				enterGame();
				
			}	
			chairBtn.username=userName;			
			chairBtn.visible=true;					
			chairBtn.removeEventListener(MouseEvent.CLICK,sitChair);
			chair.removeEventListener(MouseEvent.CLICK,sendItemId);		
		}
		/**
		 *接收7.3的返回信息，并处理站起信息 
		 * @param userName   返回信息中站起的人的uid
		 * @param itemId	   返回信息中站起的椅子id
		 * 
		 */	
		private function getStandInfo(userName:String,itemId:int):void
		{
			var chairName:String=itemId.toString();
			var chairBtn:chairState=view.btnLayer.getChildByName(chairName+"chairBtn") as chairState;
			var chair:MovieClip=view.itemLayer.getChildByName(chairName) as MovieClip;
			chairBtn.username="";	
			chairBtn.visible=false;
			if(standing==true)
			{
				chairBtn.visible=true;
			}
			chairBtn.addEventListener(MouseEvent.CLICK,sitChair);
			chair.addEventListener(MouseEvent.CLICK,sendItemId);
			if (userName==UserId)
			{
				var iout:int=view.btnLayer.numChildren;
				for (var i:int=0;i<iout;i++)
				{					
					view.btnLayer.getChildAt(i).visible=true;					
				}
				standing=true;	
				view.gameLayer.unloadModule();
				view.storeMain.mouseChildren=true;
				view.storeMain.mouseEnabled=true;	
			}			
		}
		/**
		 *自动根据方向设置chair的相关属性 
		 * @param chair  chair本身
		 * @param _chairHeading   chair方向
		 * 
		 */		
		private function handingChange(chair:MovieClip,_chairHeading:int):void
		{	
			
			switch(_chairHeading)
			{
				case 0:{						
					chair.scaleX=1;
					chair.gotoAndStop(1);						
				}
					break;
				case 1:{						
					chair.scaleX=-1;
					chair.gotoAndStop(1);
					
				}
					break;
				case 2:{
					chair.scaleX=-1;
					chair.gotoAndStop(2);
				}
					break;
				case 3:{	
					chair.scaleX=1;
					chair.gotoAndStop(2);
				}
					break;
			}			
		}
		
		/**
		 * 重新排序 
		 * @param layer 所需要排序的层
		 * 
		 */
		private function sortInit(layer:UIComponent):void
		{
			var sortArray:Array=new Array();
			var arrayLength:int=layer.numChildren;
			for (var i:int=0;i<arrayLength;i++)
			{
				var obj:MovieClip=(layer.getChildAt(i) as MovieClip);				
				var point:Point=twoToOne(new Point(obj.x,obj.y));				
				sortArray.push({
					"Level":int(point.x*100+point.y+10000),
					"sortData":obj
				});				
			}
			sortArray.sortOn("Level");			
			for (var j:int=0;j<arrayLength;j++)
			{				
				layer.swapChildrenAt(j,layer.getChildIndex(sortArray[j].sortData as MovieClip));					
			}
		}
		
		
		//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<				游戏系统进出				>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>//		
		/**
		 *离开店铺 
		 * @param e
		 * 
		 */		
		private function outStore(e:Event=null):void
		{
			var reMessage:RequestMessage = new RequestMessage();
			var proxy:SocketProxy = facade.retrieveProxy(ProxyNames.SocketProxy) as SocketProxy;
			reMessage.type=6;
			reMessage.subtype=4;
			proxy.send(reMessage);		
			//view.chooseLabel.text="列表读取中...";
		}		
		/**
		 *进入游戏
		 * @param e 
		 * 
		 */		
		private function enterGame():void
		{
			view.gameLayer.loadModule(ModuleName.GAME_MODULE);
			view.storeMain.mouseChildren=false;
			view.storeMain.mouseEnabled=false;			
		}
		
		
		//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<			转换坐标                   >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>//		
		/**
		 * 坐标转换
		 * 实际位置转相对坐标
		 * @param _point 物品实际位置x，y
		 * @return 相对坐标x，y
		 * 
		 */
		private function twoToOne(_point:Point):Point
		{
			var tempPoint:Point=new Point();
			var tempPointA:int=(_point.x-view.main.width/2)/60;
			var tempPointB:int=(_point.y+100-view.main.height/2)/30;
			var tempPointX:int=(tempPointA+tempPointB)/2;
			var tempPointY:int=tempPointB-tempPointX;
			tempPoint.x=tempPointX;
			tempPoint.y=tempPointY;
			
			return tempPoint;
		}
		/**
		 * 坐标转换
		 * 相对坐标转实际位置
		 * @param _point 相对坐标x,y
		 * @return 实际位置的x,y
		 * 
		 */		
		private function oneToTwo(_point:Point) :Point
		{
			var tempPoint:Point=new Point();
			tempPoint.x=view.main.width/2+60*(_point.x-_point.y);
			tempPoint.y=view.main.height/2+30*(_point.x+_point.y)-100;
			
			return tempPoint;
		}		
		
	}
}